package com.hw.one.dam2.util;

import com.hw.one.dam2.po.SiteAirQualityPO;

import java.util.Comparator;

/**
 *  * 比较 mongo 中读取的 空气质量数据
 * Created by Administrator on 2017/6/27 0027.
 */
@SuppressWarnings("rawtypes")
public class AQIComparatorObject implements Comparator<SiteAirQualityPO> {

    @Override
    public int compare(SiteAirQualityPO o1, SiteAirQualityPO o2) {
        Object aqiObj01 = o1.getAQI();
        aqiObj01 = null==aqiObj01 || "".equals(aqiObj01) ? "0" : aqiObj01;
        Object aqiObj02 = o2.getAQI();
        aqiObj02 = null==aqiObj02 || "".equals(aqiObj02) ? "0" : aqiObj02;

        return Integer.valueOf(aqiObj02.toString()).compareTo(Integer.valueOf(aqiObj01.toString()));
    }

}
